package com.sanyang.lawyer.controller.Case_law;

import com.sanyang.lawyer.ResultApi.ResponseResult;
import com.sanyang.lawyer.entity.Case_type;
import com.sanyang.lawyer.service.Case.Case_typeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("case_type")
public class TypeController {
    
    @Autowired
    private Case_typeService typeService;

    //根据id查询一条数据
    @RequestMapping("queryByid")
    public ResponseResult<Case_type> queryByid(int id){
        return ResponseResult.success(typeService.queryByid(id));
    }

    //查询所有的父类型
    @RequestMapping("queryParent")
    public ResponseResult<List<Case_type>> queryParent(){
        return ResponseResult.success(typeService.queryParent());
    }


    //根据父类型id 查询所有的子类型
    @RequestMapping("queryParent_children")
    public ResponseResult<List<Case_type>> queryParent_children(int pid){
        return ResponseResult.success(typeService.queryParent_children(pid));
    }

    //查询所有的类型
    @RequestMapping("queryAll")
    public ResponseResult<List<Case_type>> queryAll(){
        return ResponseResult.success(typeService.queryAll());
    }
    
    
}
